package com.summer.learn.handlers;

import com.summer.learn.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class HelloWorld {

    @Autowired
    private UserService userService;

    public HelloWorld() {
        System.out.println("HelloWorld constructor...");
    }

    /**
     * 1. 使用 @RequestMapping 注解来映射请求的URL
     * 2. 返回值会通过视图解析器解析为目标视图，对于 InternalResourceViewResolver 视图解析器而言，会做如下的解析操作：
     * prefix + returnValue + suffix, 例如：结合springmvc配置，下面这个方法会得到 "/WEB-INF/views/" + "hello" + ".jsp" 然后做转发操作
     * @return
     */
    @RequestMapping("/hello")
    public String hello() {
        System.out.println("hello Spring mvc");
        return "hello";
    }

}
